package chapter9;

/**
 * Created by lenovo on 2016/4/2.
 */
import java.util.*;

class Student{
    String number;
   // String name;
   // int score;,,int score,String name
    Student(String number){
        this.number=number;
     //   this.name=name;
      //  this.score=score;,"Justin",90),"Monica",100,"Justin",100,"Monica",90,"Monica",100
    }

    @Override
    public int hashCode(){
        int hash=7;
        hash=47*hash+Objects.hash(this.number);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Student other = (Student) obj;
        if (!Objects.equals(this.number, other.number)) {
            return false;
        }
        return true;
    }
    @Override
    public String toString() {
        return String.format("%s", number);
    }
}
public class Main5 {
    public static void main(String[] args) {
        Set<Student> students=new HashSet<>();
        students.add(new Student("B1234"));
        students.add(new Student("B5678"));
        students.add(new Student("B1234"));
        students.add(new Student("B5678"));
        students.add(new Student("B5678"));
        System.out.printf("%d ;%s ;%n)",students.size(),students);
    }
}
